package com.ieheima.demo02;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo03 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();
        FutureTask<String> ft = new FutureTask<>(mc);
        Thread th = new Thread(ft);
        th.start();

        MyCallable mc1 = new MyCallable();
        FutureTask<String> ft1 = new FutureTask<>(mc1);
        Thread th1 = new Thread(ft1);
        th1.start();
        String str = ft.get();
        System.out.println(str);
        System.out.println("-----------------------------");
        String str1 = ft1.get();
        System.out.println(str1);
    }
}
